package com.hgw.Demo02CommandPattern.Exercises17_10_6;

/**
 * Data time:2021/12/16 23:35
 * StudentID:2019112118
 * Author:hgw
 * Description: 客户端测试类
 */
public class Client {
    public static void main(String[] args) {
        BoardScreen screen = new BoardScreen(); //接收者
        Menu menu = screen.getMenu();
        Command openCommand,createCommand,editCommand;  // 命令
        openCommand = new OpenCommand(screen);
        createCommand = new CreateCommand(screen);
        editCommand = new EditCommand(screen);

        MenuItem openItem,createItem,editItem;


        openItem = (MenuItem) menu.itemList.get(0);
        createItem = (MenuItem) menu.itemList.get(1);
        editItem = (MenuItem) menu.itemList.get(2);

        openItem.setCommand(openCommand);
        createItem.setCommand(createCommand);
        editItem.setCommand(editCommand);


        screen.display();
        openItem.click();
        createItem.click();
        editItem.click();
    }
}
